import chess

from src.chess_util import Chess
from src.mcts import Mcts
import time

tal_chess = Chess()
# fen = 'rnbqk1nr/pp1p1ppp/2p5/2b1p3/2B1P3/2N5/PPPP1PPP/R1BQK1NR w KQkq - 4 5'
# 黑棋
fen = 'rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2'
mcts = Mcts()
if __name__ == '__main__':
    start = time.time()
    my_chess = Chess()
    board = chess.Board(fen)
    internal = tal_chess.parse_internal_board_info(board, fen)
    value = tal_chess.do_evaluate(board, internal)
    step, parsed_fen = mcts.mct_search_analyze(fen)

    print("step->", step)
    print('parsed_fen->', parsed_fen)
    san = chess.Board(fen).san(step)
    print("san->", san)
    end = time.time()
    print("耗时为", end - start)
